package selectClass;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import selectClass.data.IngredientRepository;

@SpringBootApplication
public class SelectClassApplication {

    public static void main(String[] args) {
        SpringApplication.run(SelectClassApplication.class, args);
    }

    @Bean
    public CommandLineRunner dataLoader(IngredientRepository repo) {
        return new CommandLineRunner() {
            @Override
            public void run(String... args) throws Exception {
                repo.save( new Ingredient("Algorithm Design", "Algorithm Design", Ingredient.Type.SUBJECT));
                repo.save(new Ingredient("Data Mining", "Data Mining", Ingredient.Type.SUBJECT));
                repo.save(new Ingredient("Data Structure", "Data Structure", selectClass.Ingredient.Type.SUBJECT));
                repo.save(new Ingredient("Operating System", "Operating System", Ingredient.Type.SUBJECT));
                repo.save(new Ingredient("Mathematical Modeling", "Mathematical Modeling", Ingredient.Type.SUBJECT));
                repo.save(new Ingredient("Software Management", "Software Management", Ingredient.Type.SUBJECT));
            }
        };
    }
}
